home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / miscellaneous / science / maths / calc / help / command < prev    next >
Encoding:
Text File  |  1996-09-07  |  3.3 KB  |  90 lines

  1. Command sequence
  2.  
  3.     This is a sequence of any the following command formats, where
  4.     each command is terminated by a semicolon or newline.  Long command
  5.     lines can be extended by using a back-slash followed by a newline
  6.     character.  When this is done, the prompt shows a double angle
  7.     bracket to indicate that the line is still in progress.  Certain
  8.     cases will automatically prompt for more input in a similar manner,
  9.     even without the back-slash.  The most common case for this is when
  10.     a function is being defined, but is not yet completed.
  11.  
  12.     Each command sequence terminates only on an end of file.  In
  13.     addition, commands can consist of expression sequences, which are
  14.     described in the next section.
  15.  
  16.  
  17.     NOTE: Calc commands are in lower case.   UPPER case is used below
  18.           for emphasis only, and should be considered in lower case.
  19.  
  20.  
  21.     DEFINE function(params) { body }
  22.     DEFINE function(params) = expression
  23.         This first form defines a full function which can consist
  24.         of declarations followed by many statements which implement
  25.         the function.
  26.  
  27.         The second form defines a simple function which calculates
  28.         the specified expression value from the specified parameters.
  29.         The expression cannot be a statement.  However, the comma
  30.         and question mark operators can be useful.  Examples of
  31.         simple functions are:
  32.  
  33.             define sumcubes(a, b) = a^3 + b^3;
  34.             define pimod(a) = a % pi();
  35.  
  36.     HELP
  37.         This displays a general help message.
  38.  
  39.     READ filename
  40.         This reads definitions from the specified filename.
  41.         The name can be quoted if desired.  The calculator
  42.         uses the CALCPATH environment variable to search
  43.         through the specified directories for the filename,
  44.         similarly to the use of the PATH environment variable.
  45.         If CALCPATH is not defined, then a default path which is
  46.         usually ":/usr/local/lib/calc" is used (that is, the current 
  47.         directory followed by a general calc library directory).  
  48.         The ".cal" extension is defaulted for input files, so 
  49.         that if "filename" is not found, then "filename.cal" is 
  50.         then searched for.  The contents of the filename are 
  51.         command sequences which can consist of expressions to 
  52.         evaluate or functions to define, just like at the top 
  53.         level command level.
  54.  
  55.     READ -once filename
  56.             This command acts like the regular READ expect that it 
  57.         will ignore filename if is has been previously read.
  58.  
  59.         This command is particularly useful in a library that
  60.         needs to read a 2nd library.  By using the READ -once
  61.         command, one will not reread that 2nd library, nor will
  62.         once risk entering into a infinite READ loop (where
  63.         that 2nd library directly or indirectly does a READ of
  64.         the first library).
  65.  
  66.     WRITE filename
  67.         This writes the values of all global variables to the
  68.         specified filename, in such a way that the file can be
  69.         later read in order to recreate the variable values.
  70.         For speed reasons, values are written as hex fractions.
  71.         This command currently only saves simple types, so that
  72.         matrices, lists, and objects are not saved.  Function
  73.         definitions are also not saved.
  74.  
  75.     QUIT
  76.         This leaves the calculator, when given as a top-level
  77.         command.
  78.  
  79.     CD
  80.         Change the current directory to the home directory, if $HOME 
  81.         is set in the environment.
  82.  
  83.     CD dir
  84.         Change the current directory to dir.
  85.  
  86.  
  87.     Also see the help topic:
  88.  
  89.         statement       flow control and declaration statements
  90.